package com.wushi.lenovo.asia5b.app_ui.orderdetail;

import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.wushi.lenovo.asia5b.R;

import butterknife.BindView;

/**
 * Created by zhangyuncai on 2020/3/12.
 */
public class OrderDetailVeriFragment extends OrderDetailFragment {

    @BindView(R.id.tv_orderdetail_orderno_text)
    TextView tv_orderdetail_orderno_text;
    @BindView(R.id.tv_orderdetail_no)
    TextView tv_orderdetail_no;
    @BindView(R.id.tv_orderdetail_time)
    TextView tv_orderdetail_time;
    @BindView(R.id.tv_orderdetail_billingaddress_content)
    TextView tv_orderdetail_billingaddress_content;
    @BindView(R.id.rv_orderdetail_goods)
    RecyclerView rv_orderdetail_goods;
    @BindView(R.id.rv_orderdetail_price)
    RecyclerView pricedetailRecyclerView;
    @BindView(R.id.tv_orderdetail_viewiransaction)
    TextView tv_orderdetail_viewiransaction;
    @BindView(R.id.tv_ordercheck_totalprice)
    TextView tv_ordercheck_totalprice;
    @BindView(R.id.ll_ordercheck_totalprice_vessel)
    LinearLayout ll_ordercheck_totalprice_vessel;

    @Override
    protected int getLayout() {
        return R.layout.fragment_orderdetail_veri;
    }

    @Override
    protected void setOrderDetailView() {
        if (model != null) {
            /*本地派送信息*/
            //订单号 tv_orderdetail_no
            tv_orderdetail_no.setText(model.getOrder_no());
            if (TextUtils.isEmpty(model.getOrder_no())) {
                tv_orderdetail_no.setText("-");
            }
            //订单时间 tv_orderdetail_time
            tv_orderdetail_time.setText(model.getOrder_date());

            //账单地址
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append(String.format("%s:", getString(R.string.billingaddress)));
            stringBuilder.append("\n");

            //拼接地址信息
            contactAddress(stringBuilder,model.getBilling_address());

            tv_orderdetail_billingaddress_content.setText(stringBuilder.toString());


            /*商品列表*/
            setGoodsView(model.getOrder_parcel(), rv_orderdetail_goods);

            //价格列表
            setPriceView(pricedetailRecyclerView,ll_ordercheck_totalprice_vessel,tv_ordercheck_totalprice);

            //设置账单下载地址
            setViewTransactionView(tv_orderdetail_viewiransaction);
        } else {
        }
    }

}
